Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(server) : snapshot traverse physical buckets #4084

Merged
merged 5 commits into from
Nov 11, 2024

Conversation

adiholden
Copy link
Collaborator

@adiholden adiholden commented Nov 7, 2024

This PR introduces new api to dash table TraversingBuckets which traveses table by physical buckets
when creating a snapshot we now call this api. The snapshot correctness stays and there are less calls to Serialize bucket callback as it is called only once per bucket and not on every slot

Signed-off-by: adi_holden <[email protected]>
src/core/dash.h Outdated
Comment on lines 970 to 971
if (curs.bucket_id() >= SegmentType::kTotalBuckets) // sanity.
return 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this restart the main loop of the caller since 0 means to start again and probably we ended up in this situation because of what re returned below ? Why not a DCHECK ? (I know it's WIP I just saw this and thought to ask)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

returning 0 means iteration finished, we have the same logic in Traverse function

Signed-off-by: adi_holden <[email protected]>
@adiholden adiholden changed the title WIP do not review yet : snapshot traverse physical buckets feat(server) : snapshot traverse physical buckets Nov 10, 2024
src/core/dash.h Outdated
// Takes an iterator pointing to an entry in a dash bucket and traverses all bucket's entries by
// calling cb(iterator) for every non-empty slot. The iteration goes over a physical bucket.
template <typename Cb> void TraverseBucket(const_iterator it, Cb&& cb);
// Traverses over a single physical bucket in table call cb once on bucket iterator.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Traverses over a single physical bucket in table call cb once on bucket iterator.
// Traverses over physical buckets. It calls cb once for each bucket by passing a bucket iterator.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

src/core/dash.h Outdated
uint32_t sid = curs.segment_id(global_depth_);
uint8_t bid = curs.bucket_id();

bool fetched = false;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: While it's not strictly necessary to iterate until we find a non-empty bucket, we could potentially iterate over the entire empty table without returning. Conversely, for densely packed tables, we might return after checking each bucket. To balance these scenarios, iterating over a fixed number of buckets (e.g., 8 or 16) regardless of the number of non-empty buckets encountered might be a smoother approach.

@@ -566,26 +566,6 @@ TEST_F(DashTest, Traverse) {
EXPECT_EQ(kNumItems - 1, nums.back());
}

TEST_F(DashTest, Bucket) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't you want to test the change?

Signed-off-by: adi_holden <[email protected]>
Signed-off-by: adi_holden <[email protected]>
Signed-off-by: adi_holden <[email protected]>
@kostasrim
Copy link
Contributor

🚢 🇮🇹

@adiholden adiholden merged commit 3ab2446 into main Nov 11, 2024
12 checks passed
@adiholden adiholden deleted the snapshot_traverse_bucket_once branch November 11, 2024 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants